<?php
use think\Db;


function getThreeList()
{
    //获取后台菜单数据
    $id = session('adminId');
    $users = Db::name('auth_group_access')->alias('aga')
            ->join('auth_group ag','aga.group_id = ag.id','left')
            ->where('uid',session('adminId'))->find();
    $new_list = [];
    if($users)
    {
    $result = Db::name('auth_rule')->where('pid',0)->where('id in ('.$users['rules'].')')->select();
    $new_list = [];

    foreach($result as $k=>$v)
    {
        $new_list[$k] = $v;
        $pid_user =Db::name('auth_rule')->where('pid',$v['id'])->where('id in ('.$users['rules'].')')->select();
        $new_list[$k]['list'] = $pid_user;
    }
    }
    // echo "<pre>";
    // print_r($new_list);die;
    return $new_list;

}